<html>
<head><meta charset="utf-8"><title>Profiling Cargo windows · t-compiler/wg-parallel-rustc · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/index.html">t-compiler/wg-parallel-rustc</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html">Profiling Cargo windows</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="182059594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182059594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182059594">(Nov 27 2019 at 21:21)</a>:</h4>
<p>as you talked about getting some numbers for windows. I did a try with my 16core 32 thread cpu with windows.<br>
building <a href="https://github.com/rust-lang/cargo/tree/14654f38d0819c47d7a605d6f1797ffbcdc65000" target="_blank" title="https://github.com/rust-lang/cargo/tree/14654f38d0819c47d7a605d6f1797ffbcdc65000">cargo@14654f</a><br>
built <a href="https://github.com/rust-lang/rust/tree/797fd92628842c1f5face9fb93b0fe4f1f9d297f" target="_blank" title="https://github.com/rust-lang/rust/tree/797fd92628842c1f5face9fb93b0fe4f1f9d297f">rustc@797fd92</a> with <code>parallel-compiler = true</code><br>
| Zthreads | total time |<br>
| ------------ | ------------- |<br>
|  1                |        41.62s |<br>
|  2                |        31.92s |<br>
|  4                |        27.34s | <br>
|  8                |        25.00s |<br>
| 16               |        24.69s |<br>
| 32               |        27.42s |</p>



<a name="182060400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182060400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182060400">(Nov 27 2019 at 21:32)</a>:</h4>
<p>the numbers is for this command <code>git clean -fdx &amp;&amp; set RUSTFLAGS=-Zthreads=N &amp;&amp; cargo +stage2 check</code></p>



<a name="182072748"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182072748" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182072748">(Nov 28 2019 at 00:51)</a>:</h4>
<p>Interesting! Looks like windows has similar issues getting slower the more threads it gets</p>



<a name="182072752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182072752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182072752">(Nov 28 2019 at 00:51)</a>:</h4>
<p>It may mean semaphores aren't as good as we thought</p>



<a name="182072754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182072754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182072754">(Nov 28 2019 at 00:51)</a>:</h4>
<p>At least on Windows</p>



<a name="182072853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182072853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182072853">(Nov 28 2019 at 00:53)</a>:</h4>
<p>hm, so that might be just "windows has other problems" -- I've not done any benchmarking at least on windows</p>



<a name="182072925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182072925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182072925">(Nov 28 2019 at 00:54)</a>:</h4>
<p>(it might be that e.g. semaphores are much better, but don't actually solve the problem, since we still see a ton of contention)</p>



<a name="182073003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182073003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182073003">(Nov 28 2019 at 00:56)</a>:</h4>
<p>Yeah I think we will want to settle the Linux story anyway first</p>



<a name="182073007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182073007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182073007">(Nov 28 2019 at 00:56)</a>:</h4>
<p>And then we can tackle other platforms if still necessary</p>



<a name="182593637"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182593637" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182593637">(Dec 04 2019 at 20:08)</a>:</h4>
<p><span class="user-mention" data-user-id="116122">@simulacrum</span>  did a local build of <a href="https://github.com/rust-lang/rust/pull/67029" target="_blank" title="https://github.com/rust-lang/rust/pull/67029">https://github.com/rust-lang/rust/pull/67029</a> and tried the same way as above and the numbers are almost exactly the same with this build</p>



<a name="182593660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182593660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182593660">(Dec 04 2019 at 20:08)</a>:</h4>
<p>oh! I was going to ping you when it finished :)</p>



<a name="182593677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182593677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182593677">(Dec 04 2019 at 20:09)</a>:</h4>
<p>but that sounds not great</p>



<a name="182593729"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182593729" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182593729">(Dec 04 2019 at 20:09)</a>:</h4>
<p>Do you know how feasible it is to determine how much time is being spent in system vs. userspace?</p>



<a name="182593854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182593854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182593854">(Dec 04 2019 at 20:10)</a>:</h4>
<p>I do not know how to do that can try to look around a bit</p>



<a name="182593939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182593939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182593939">(Dec 04 2019 at 20:11)</a>:</h4>
<p>that would be amazing; I don't know anything about Windows I'm afraid :)</p>



<a name="182594186"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182594186" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182594186">(Dec 04 2019 at 20:14)</a>:</h4>
<p>what I did yesterday was to try to use WPA that is the gui to windows event tracing and then I see that all the threads is woken at the same time and then there is some delay and then it happens again</p>



<a name="182594236"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182594236" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182594236">(Dec 04 2019 at 20:15)</a>:</h4>
<p>ah</p>



<a name="182594259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182594259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182594259">(Dec 04 2019 at 20:15)</a>:</h4>
<p>so that's the behavior we were suspecting we'd see on linux without semaphores</p>



<a name="182594273"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182594273" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182594273">(Dec 04 2019 at 20:15)</a>:</h4>
<p>I guess windows is exhibiting similar behavior then which is ... not great</p>



<a name="182594343"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182594343" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182594343">(Dec 04 2019 at 20:16)</a>:</h4>
<p>(considering we're using semaphores there)</p>



<a name="182594351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182594351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182594351">(Dec 04 2019 at 20:16)</a>:</h4>
<p>I wonder if we can pass some flag or something</p>



<a name="182594369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182594369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182594369">(Dec 04 2019 at 20:16)</a>:</h4>
<p>can try to see if I can see the same for the new build.<br>
but I do not know the tools and things that well so maybe I miss read the logs</p>



<a name="182594536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182594536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182594536">(Dec 04 2019 at 20:18)</a>:</h4>
<p>makes sense</p>



<a name="182598277"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182598277" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182598277">(Dec 04 2019 at 20:56)</a>:</h4>
<p>can not find any way to see the system vs user time in windows and maybe the all wake at the same time is not a problem when I have looked at the self-profile chrome tracing logs the execution is bursty so maybe there only was alot of work to do.</p>



<a name="182598324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182598324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182598324">(Dec 04 2019 at 20:57)</a>:</h4>
<p><span class="user-mention" data-user-id="125799">@andjo403</span> thanks for doing the legwork here!</p>



<a name="182598443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182598443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182598443">(Dec 04 2019 at 20:58)</a>:</h4>
<p><a href="/user_uploads/4715/2IAEV5mWnfrN9jZqa_8bDbNm/pasted_image.png" target="_blank" title="pasted_image.png">self-profiling log</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/2IAEV5mWnfrN9jZqa_8bDbNm/pasted_image.png" target="_blank" title="self-profiling log"><img src="/user_uploads/4715/2IAEV5mWnfrN9jZqa_8bDbNm/pasted_image.png"></a></div>



<a name="182598462"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182598462" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182598462">(Dec 04 2019 at 20:58)</a>:</h4>
<p>Unfortunately the only API I know of to get user/kernel times is <a href="https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getprocesstimes" target="_blank" title="https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getprocesstimes">https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getprocesstimes</a>, but that's very low-level and you'd have to iterate over all processes spawned by Cargo</p>



<a name="182598486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182598486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182598486">(Dec 04 2019 at 20:58)</a>:</h4>
<p>the cpu time unfortunately won't be too useful because if it's all being spent in the kernel that's not too useful</p>



<a name="182598515"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling%20Cargo%20windows/near/182598515" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/187679-t-compiler/wg-parallel-rustc/topic/Profiling.20Cargo.20windows.html#182598515">(Dec 04 2019 at 20:59)</a>:</h4>
<p>(which is the problem we had on linux)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>